package com.dodock.android.banglapapers.ui;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

import com.dodock.android.banglapapers.BanglaNews;
import com.dodock.android.banglapapers.MyApplication;
import com.dodock.android.banglapapers.R;
import com.google.analytics.tracking.android.GoogleAnalytics;
import com.google.analytics.tracking.android.Tracker;

public class AboutHelpActivity extends Activity{
	
	private Tracker mGaTracker;
	private GoogleAnalytics mGaInstance;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		//Google Analytics
		try{
		    mGaInstance = GoogleAnalytics.getInstance(this);
		    mGaTracker = mGaInstance.getTracker(getResources().getString(R.string.ga_trackingId));
		}
		catch (Exception e) {
		}
		//--Google Analytics
		
		
		setContentView(R.layout.about_help);
		String screen = getIntent().getExtras().getString("screen");
		TextView title = (TextView) findViewById(R.id.title);
		TextView bodyText = (TextView) findViewById(R.id.body_text);		
		if(screen.equalsIgnoreCase("help")){
			title.setText(R.string.help);
			try{
				bodyText.setText(BanglaNews.configuration.getHelpText());
			}
			catch (Exception e) {
				// TODO: handle exception
			}
		}
		else{
			title.setText(R.string.aboutTitle);
			try{
				bodyText.setText(BanglaNews.configuration.getAboutText());
			}
			catch (Exception e) {
				// TODO: handle exception
			}
		}		
	}
	
	@Override
	protected void onStart() {
		super.onStart();
		try {
			mGaTracker.sendView("/About");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	@Override
	protected void onStop() {
		super.onStop();
	}
	
	@Override
	protected void onResume() {
		super.onResume();
		com.facebook.Settings.publishInstallAsync(this, MyApplication.fb_app_id);
	}
	
}
